<template>
  <div class="page-title-box margin-b-10 flex-par">
    <img src="../../assets/image/icon6.png" class="title-icon" alt="">
    <div>开发者中心</div>
  </div>
  
  <div class="list-content white-bk">
    <div class="page-info-box flex-par">
      <!-- <img class="info-img" src="../../assets/image/home-bk.jpg" alt=""> -->
      <div class="info-img" v-if="kaifaData.cnName">{{ kaifaData.cnName.substring(0, 1) }}</div>
      <div class="flex-son">
        <div class="info-name">{{ kaifaData.cnName }}</div>
        <div class="list-item-action flex-par">
          <div v-if="kaifaData.isAdmin" class="list-btn blue-btn flex-par active-style">
            <img class="list-btn-icon" src="../../assets/image/icon9.png" alt="">
            <div>超级管理员</div>
          </div>
          <div v-if="kaifaData.isDeveloper" class="list-btn white-btn flex-par active-style">
            <img class="list-btn-icon" src="../../assets/image/icon10.png" alt="">
            <div>开发者</div>
          </div>
        </div>
      </div>
      <div class="info-item white-info flex-par">
        <img class="info-icon" src="../../assets/image/icon7.png" alt="">
        <div>
          <div class="info-txt">已上传</div>
          <div class="info-num"> <span class="num-txt">{{ kaifaData.appsUploaded }}</span>个应用 </div>
        </div>
      </div>
      <!-- <div class="info-item blue-info flex-par">
                <img class="info-icon" src="../../assets/image/icon8.png" alt="">
                <div>
                  <div class="info-txt">已上传</div>
                  <div class="info-num"> <span class="num-txt">333</span>个应用 </div>
                </div>
              </div> -->
    </div>
    
    <!-- 搜索区域 -->
    <div class="search-section">
      <div class="search-container">
        <div class="search-box">
          <input 
            v-model="searchKeyword" 
            @keyup.enter="handleSearch"
            @input="handleSearchInput"
            placeholder="搜索我的应用..." 
            class="search-input"
            type="text"
          />
          <button @click="handleSearch" class="search-btn" :disabled="isSearching">
            <svg v-if="!isSearching" class="search-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
              <circle cx="11" cy="11" r="8"></circle>
              <path d="M21 21l-4.35-4.35"></path>
            </svg>
            <svg v-else class="search-icon loading" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
              <circle cx="12" cy="12" r="10"></circle>
              <path d="M12 6v6l4 2"></path>
            </svg>
            {{ isSearching ? '搜索中...' : '搜索' }}
          </button>
          <button v-if="searchKeyword" @click="clearSearch" class="clear-btn">
            <svg class="clear-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
              <line x1="18" y1="6" x2="6" y2="18"></line>
              <line x1="6" y1="6" x2="18" y2="18"></line>
            </svg>
          </button>
        </div>
        <div v-if="isSearchMode" class="search-info">
          <span class="search-result-count">找到 {{ dataTotal }} 个相关应用</span>
          <span class="search-keyword">关键词: "{{ searchKeyword }}"</span>
        </div>
      </div>
    </div>
    
    <!-- <div class="list-item" v-for="item in tableData" :key="item">{{ item.rpaRobotName }} </div> -->
    <div class="modern-card-grid">
      <div class="modern-card" v-for="(item, index) in tableData" :key="item" :style="{ 'animation-delay': index * 0.1 + 's' }" :class="'card-theme-' + (index % 4)">
        <!-- 卡片头部 -->
        <div class="card-header">
          <div class="card-icon">
            <div class="icon-circle">
              <span class="icon-text">{{ item.rpaRobotName ? item.rpaRobotName.charAt(0).toUpperCase() : 'A' }}</span>
            </div>
          </div>
          <div class="card-title-section">
            <h3 class="card-title">{{ item.rpaRobotName }}</h3>
            <div class="card-subtitle">{{ item.businessTypeName }}</div>
          </div>
        </div>
        
        <!-- 卡片内容 -->
        <div class="card-content">
          <!-- 应用描述 -->
          <div class="card-description">
            <p class="description-text">{{ item.content || '暂无应用描述' }}</p>
          </div>
          
          <!-- 元数据信息 -->
          <div class="card-meta">
            <div class="meta-row">
              <div class="meta-item-inline">
                <svg class="meta-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                  <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
                  <circle cx="12" cy="7" r="4"></circle>
                </svg>
                <span class="meta-text">{{ item.developerName || '未知' }}</span>
              </div>
              <div class="meta-item-inline">
                <svg class="meta-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                  <rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>
                  <line x1="16" y1="2" x2="16" y2="6"></line>
                  <line x1="8" y1="2" x2="8" y2="6"></line>
                  <line x1="3" y1="10" x2="21" y2="10"></line>
                </svg>
                <span class="meta-text">{{ item.uploadDate }}</span>
              </div>
            </div>
          </div>
        </div>
        
        <!-- 卡片操作 - 2x2网格布局 -->
        <div class="card-actions-grid">
          <button class="action-btn primary-btn" @click="toDetail(item.id)">
            <svg class="btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
              <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>
              <circle cx="12" cy="12" r="3"></circle>
            </svg>
            <span class="btn-text">查看详情</span>
          </button>
          <button class="action-btn secondary-btn" @click="toEdit(item.id)">
            <svg class="btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
              <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
              <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
            </svg>
            <span class="btn-text">编辑</span>
          </button>
          <!-- 管理员专用：设为精选按钮 -->
          <button v-if="kaifaData.isAdmin" 
                  class="action-btn featured-btn" 
                  @click="toggleFeatured(item.id, item.isFeatured)"
                  :class="{ 'featured-active': item.isFeatured }">
            <svg class="btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
              <polygon points="12,2 15.09,8.26 22,9.27 17,14.14 18.18,21.02 12,17.77 5.82,21.02 7,14.14 2,9.27 8.91,8.26"></polygon>
            </svg>
            <span class="btn-text">{{ item.isFeatured ? '取消精选' : '设为精选' }}</span>
          </button>
          <button class="action-btn danger-btn" @click="deleteItem(item.id)">
            <svg class="btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
              <polyline points="3,6 5,6 21,6"></polyline>
              <path d="M19,6v14a2,2 0 0,1 -2,2H7a2,2 0 0,1 -2,-2V6m3,0V4a2,2 0 0,1 2,-2h4a2,2 0 0,1 2,2v2"></path>
            </svg>
            <span class="btn-text">删除</span>
          </button>
        </div>
      </div>
    </div>
    <div class="pagination-box flex-par">
      <el-pagination class="flex-par" :currentPage="searchForm.pageNum" :page-size="searchForm.pageSize" :small="true"
        background="#F4F4F4" layout="total,  prev, pager, next" :total="dataTotal" @current-change="getPageList" />
    </div>
  </div>
</template>
<script>
// import // boundEmpSys,
// '@/assets/api/api.js';

import headerBox from '@/components/headerBox';


import { bizTypeMenu, getKaifaData, getSelectByType, pageSize, serverUrl, deleteRpa, updateFeaturedStatus, searchUserRobots } from '@/assets/api/api.js';
import { RouterView } from 'vue-router';
export default {
  data: function () {
    return {
      serverUrl,
      radioV: '',
      typeMenuList: [],
      typeId: '-1',
      tableData: [],
      dataTotal: 0,
      searchForm: {
        bizType: '',
        subBizType: '',
        pageNum: 1,
        pageSize: 12,
      },
      kaifaData: {},
      // 搜索相关
      searchKeyword: '',
      isSearching: false,
      isSearchMode: false
    }
  },
  components: {
  },
  mounted() {
    this.getKaifaDataF()
    this.getBizTypes()
    this.getPageList(1)

  },
  methods: {
    deleteItem(id) {
      this.$confirm('确定删除吗？', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
      }).then(() => {
        deleteRpa({ id })
          .then((res) => {
            if (res.code == 0) {
              this.$message({
                message: '操作成功',
                type: 'success',
                center: true,
              });
              this.getPageList()
            }
          })
          .catch((err) => { });
      });
    },
    toDetail(id) {
      this.$router.push({ path: '/yingyongDetail/' + id });
    },
    toEdit(id) {
      this.$router.push({ path: '/kaifaForm', query: { id } });
    },
    //   -列表
    getPageList(pageNum) {
      if (pageNum) {
        this.searchForm.pageNum = pageNum
      }
      this.searchForm.bizType = this.typeId == '-1' ? '' : this.typeId
      getSelectByType(this.searchForm)
        .then((res) => {
          console.log(res)
          if (res.code == 0) {
            //console.log(res.data)
            this.tableData = res.data
            this.dataTotal = res.total
          }
        })
        .catch((err) => { });
    },
    changeType(v, v2) {
      console.log(v)
      console.log(v2)
      this.typeId = v
      this.getPageList(1)
    },
    // toHome() {
    //   this.$router.push({ path: '/' });
    // },
    // handleClose(e) {
    //   //console.log(e);
    // },
    // gotoMap() {
    //   // window.location.href = 'index.html'
    //   window.location.href = `http://${window.location.hostname}`;
    // },
    getBizTypes() {
      bizTypeMenu()
        .then((res) => {
          console.log(res)
          if (res.code == 0) {
            this.typeMenuList = res.data.children
          }
        })
        .catch((err) => { });
    },
    getKaifaDataF() {
      getKaifaData()
        .then((res) => {
          console.log(res)
          if (res.code == 0) {
            this.kaifaData = res.data
          }
        })
        .catch((err) => { });
    },
    // 切换精选状态
    toggleFeatured(id, currentStatus) {
      const newStatus = !currentStatus;
      const action = newStatus ? '设为精选' : '取消精选';
      
      this.$confirm(`确定要${action}这个应用吗？`, '确认操作', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        updateFeaturedStatus(id, newStatus)
          .then((res) => {
            if (res.code == 0) {
              this.$message({
                message: `${action}成功`,
                type: 'success',
                center: true,
              });
              // 更新本地数据
              const item = this.tableData.find(item => item.id === id);
              if (item) {
                item.isFeatured = newStatus;
              }
            } else {
              this.$message({
                message: res.message || `${action}失败`,
                type: 'error',
                center: true,
              });
            }
          })
          .catch((err) => {
            this.$message({
              message: `${action}失败，请稍后重试`,
              type: 'error',
              center: true,
            });
          });
      }).catch(() => {
        // 用户取消操作
      });
    },

    // 搜索相关方法
    handleSearch() {
      if (!this.searchKeyword.trim()) {
        this.clearSearch();
        return;
      }
      
      this.isSearching = true;
      this.isSearchMode = true;
      
      const params = {
        robotName: this.searchKeyword.trim(),
        pageNum: 1,
        pageSize: this.searchForm.pageSize
      };
      
      searchUserRobots(params)
        .then((res) => {
          this.isSearching = false;
          if (res.code == 0) {
            this.tableData = res.data.list;
            this.dataTotal = res.data.total;
            this.searchForm.pageNum = 1;
          } else {
            this.$message({
              message: res.message || '搜索失败',
              type: 'error',
              center: true,
            });
          }
        })
        .catch((err) => {
          this.isSearching = false;
          this.$message({
            message: '搜索失败，请稍后重试',
            type: 'error',
            center: true,
          });
        });
    },

    handleSearchInput() {
      // 实时搜索防抖处理
      clearTimeout(this.searchTimeout);
      this.searchTimeout = setTimeout(() => {
        if (this.searchKeyword.trim()) {
          this.handleSearch();
        }
      }, 500);
    },

    clearSearch() {
      this.searchKeyword = '';
      this.isSearchMode = false;
      this.getPageList(1);
    },

    // 修改分页方法，支持搜索模式
    getPageList(pageNum) {
      if (pageNum) {
        this.searchForm.pageNum = pageNum;
      }
      
      if (this.isSearchMode && this.searchKeyword.trim()) {
        // 搜索模式下的分页
        const params = {
          robotName: this.searchKeyword.trim(),
          pageNum: this.searchForm.pageNum,
          pageSize: this.searchForm.pageSize
        };
        
        searchUserRobots(params)
          .then((res) => {
            if (res.code == 0) {
              this.tableData = res.data.list;
              this.dataTotal = res.data.total;
            }
          })
          .catch((err) => {
            this.$message({
              message: '加载失败，请稍后重试',
              type: 'error',
              center: true,
            });
          });
      } else {
        // 正常模式下的分页
        this.searchForm.bizType = this.typeId == '-1' ? '' : this.typeId;
        getSelectByType(this.searchForm)
          .then((res) => {
            if (res.code == 0) {
              this.tableData = res.data;
              this.dataTotal = res.total;
            }
          })
          .catch((err) => { });
      }
    },
  },
};
</script>
<style scoped>
.layout {
  height: 100%;
}

.layout-content {
  height: 100%;
  width: 100%;
  background: white;
  /* background-size: 100% 100%; */
}

.content-box {
  height: calc(100% - 70px);
  width: 100%;
  background: #f8f8f8;
}

.contentLeft {
  background-color: rgba(0, 21, 42, 1);
}

.el-sub-menu /deep/ .el-menu {
  background-color: rgba(0, 21, 42, 1);
}

.contentLeft .el-sub-menu .el-menu li {
  width: 100%;
  box-sizing: inherit;
  background: rgba(0, 21, 42, 1);
}

.contentLeft /deep/ .el-menu-item,
.contentLeft /deep/ .el-sub-menu__title {
  height: 40px;
  line-height: 40px;
  color: white;
  border-radius: 40px;
  font-size: 14px;
}


.contentLeft /deep/ .el-sub-menu__title:hover {
  background: rgba(53, 107, 226, 1) !important;
  border-radius: 40px;
}

.contentLeft /deep/ .el-menu-item:hover {
  background: rgba(53, 107, 226, 1) !important;
  border-radius: 40px;
}

.contentLeft /deep/ .el-menu-item.is-active {
  background-color: rgba(53, 107, 226, 1) !important;
  border-radius: 40px;
}

.yingyong-page {
  height: 100%;
  flex: 1;
  overflow: auto;
  background-color: #F1F9FE;
}

.page-title-box {
  height: 60px;
  line-height: 60px;
  color: #00152A;
  font-size: 18px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  z-index: 10;
  animation: slideInDown 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.title-icon {
  height: 35px;
  margin: 12.5px 5px 0 10px;
}


.list-content {
  height: calc(100% - 70px);
  overflow: auto;
}


/* 现代化卡片网格布局 */
.modern-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 20px;
  width: 100%;
  box-sizing: border-box;
}

/* 大屏幕优化 */
@media (min-width: 1400px) {
  .modern-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    padding: 24px;
  }
}

@media (min-width: 1600px) {
  .modern-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
    padding: 28px;
  }
}

/* 现代化卡片样式 */
.modern-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.9) 100%);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.08),
    0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  animation: slideInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.modern-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #10b981 0%, #3b82f6 50%, #f59e0b 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modern-card:hover {
  transform: translateY(-8px);
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.12),
    0 8px 16px rgba(0, 0, 0, 0.08);
  border-color: rgba(16, 185, 129, 0.2);
}

.modern-card:hover::before {
  opacity: 1;
}

/* 卡片主题配色 */
.card-theme-0 .icon-circle {
  background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.card-theme-0 .card-description {
  background: rgba(16, 185, 129, 0.03);
  border-left-color: rgba(16, 185, 129, 0.2);
}

.card-theme-0 .meta-row {
  background: rgba(16, 185, 129, 0.05);
  border-left-color: #10b981;
}

.card-theme-0 .meta-icon {
  color: #10b981;
}

.card-theme-1 .icon-circle {
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.card-theme-1 .card-description {
  background: rgba(59, 130, 246, 0.03);
  border-left-color: rgba(59, 130, 246, 0.2);
}

.card-theme-1 .meta-row {
  background: rgba(59, 130, 246, 0.05);
  border-left-color: #3b82f6;
}

.card-theme-1 .meta-icon {
  color: #3b82f6;
}

.card-theme-2 .icon-circle {
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.card-theme-2 .card-description {
  background: rgba(245, 158, 11, 0.03);
  border-left-color: rgba(245, 158, 11, 0.2);
}

.card-theme-2 .meta-row {
  background: rgba(245, 158, 11, 0.05);
  border-left-color: #f59e0b;
}

.card-theme-2 .meta-icon {
  color: #f59e0b;
}

.card-theme-3 .icon-circle {
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.card-theme-3 .card-description {
  background: rgba(139, 92, 246, 0.03);
  border-left-color: rgba(139, 92, 246, 0.2);
}

.card-theme-3 .meta-row {
  background: rgba(139, 92, 246, 0.05);
  border-left-color: #8b5cf6;
}

.card-theme-3 .meta-icon {
  color: #8b5cf6;
}

/* 卡片头部 */
.card-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.card-icon {
  flex-shrink: 0;
}

.icon-circle {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transition: all 0.3s ease;
}

.modern-card:hover .icon-circle {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.icon-text {
  color: white;
  font-weight: 700;
  font-size: 18px;
  text-transform: uppercase;
}

.card-title-section {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: #1a1a2e;
  margin: 0 0 4px 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-subtitle {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 卡片内容 */
.card-content {
  margin-bottom: 20px;
}

/* 应用描述 */
.card-description {
  margin-bottom: 16px;
  padding: 12px;
  background: rgba(16, 185, 129, 0.03);
  border-radius: 8px;
  border-left: 3px solid rgba(16, 185, 129, 0.2);
}

.description-text {
  font-size: 14px;
  line-height: 1.6;
  color: #4a5568;
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  min-height: 5.6em; /* 4行 × 1.4行高 */
}

.card-meta {
  margin-top: 12px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 8px 12px;
  background: rgba(59, 130, 246, 0.05);
  border-radius: 8px;
  border-left: 3px solid #3b82f6;
}

.meta-item-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.meta-icon {
  width: 14px;
  height: 14px;
  color: #3b82f6;
  flex-shrink: 0;
}

.meta-text {
  font-size: 13px;
  color: #4a5568;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 卡片操作按钮 - 2x2网格布局 */
.card-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 6px;
  width: 100%;
  padding: 8px 0;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  border: none;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  height: 48px;
  width: 100%;
  text-align: center;
}

.action-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.3s ease;
}

.action-btn:hover::before {
  left: 100%;
}

.btn-icon {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  flex-shrink: 0;
}

.btn-text {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.primary-btn {
  background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.primary-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.secondary-btn {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.secondary-btn:hover {
  background: rgba(59, 130, 246, 0.15);
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.danger-btn {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.danger-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.featured-btn {
  background: rgba(255, 215, 0, 0.1);
  color: #FFD700;
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.featured-btn:hover {
  background: rgba(255, 215, 0, 0.2);
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.featured-btn.featured-active {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: white;
  border: 1px solid #FFD700;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.featured-btn.featured-active:hover {
  background: linear-gradient(135deg, #FFA500, #FF8C00);
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.list-btn {
  font-size: 15px;
  height: 28px;
  line-height: 28px;
  border-radius: 14px;
  padding: 0 10px;
  margin-left: 10px;
}

.white-btn {
  border: 1px solid rgba(215, 215, 215, 1);
}

.blue-btn {
  background: linear-gradient(135deg, rgba(53, 107, 226, 1), rgba(0, 242, 241, 1));
  border: none;
  color: white;
  box-shadow: 0 4px 15px rgba(53, 107, 226, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.blue-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s;
}

.blue-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(53, 107, 226, 0.4);
}

.blue-btn:hover::before {
  left: 100%;
}

.list-btn-icon {
  height: 16px;
  margin-top: 6px;
  margin-right: 2px;
}

.page-info-box {
  background: rgba(255, 255, 255, 0.9);
  margin: 20px;
  border-radius: 20px;
  padding: 30px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: slideInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-info-box:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.info-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin-right: 16px;
  background: linear-gradient(135deg, #436ADB, #00f2f1);
  text-align: center;
  line-height: 80px;
  font-size: 40px;
  color: white;
  box-shadow: 0 8px 25px rgba(67, 106, 219, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: pulse 2s infinite;
}

.info-img:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 35px rgba(67, 106, 219, 0.4);
}

@keyframes pulse {
  0% {
    box-shadow: 0 8px 25px rgba(67, 106, 219, 0.3);
  }
  50% {
    box-shadow: 0 8px 25px rgba(67, 106, 219, 0.5);
  }
  100% {
    box-shadow: 0 8px 25px rgba(67, 106, 219, 0.3);
  }
}

.info-name {
  font-size: 24px;
  font-weight: 600;
  color: black;
  letter-spacing: 3px;
}

.page-info-box .list-item-action {
  border-top: none;
}

.info-item {
  height: 80px;
  border: 1px solid rgba(47, 90, 201, 1);
  border-radius: 10px;
  margin-left: 20px;
  padding: 10px 25px;
}

.white-info {
  background-color: white;
}

.blue-info {
  background-color: rgba(53, 107, 226, 1);
  color: white;
}

.info-icon {
  height: 44px;
  width: 44px;
  margin-right: 10px;
  margin-top: 9px;
}

.info-txt {
  font-size: 18px;
  color: #000;
  font-weight: 700;
}

.info-num {
  font-size: 14px;
}

.num-txt {
  font-size: 24px;
  font-weight: 600;
  margin-right: 4px;
  color: #2F5AC9;
}

.blue-info .info-txt {
  color: white;
}

.blue-info .num-txt {
  color: #F59A23;
}

/* 响应式设计 */
@media (max-width: 1200px) {
  .modern-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    padding: 18px;
  }
}

@media (max-width: 768px) {
  .modern-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
    padding: 16px;
  }
  
  .modern-card {
    padding: 20px;
  }
  
  .card-header {
    gap: 12px;
    margin-bottom: 16px;
  }
  
  .icon-circle {
    width: 40px;
    height: 40px;
  }
  
  .icon-text {
    font-size: 16px;
  }
  
  .card-title {
    font-size: 16px;
  }
  
  .card-subtitle {
    font-size: 13px;
  }
  
  /* 移动端按钮布局调整 */
  .card-actions-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 5px;
    padding: 6px 0;
  }
  
  .action-btn {
    height: 40px;
    padding: 6px 2px;
    font-size: 9px;
  }
  
  .btn-icon {
    width: 14px;
    height: 14px;
  }
  
  .btn-text {
    font-size: 9px;
  }
  
  .description-text {
    font-size: 13px;
    -webkit-line-clamp: 3;
    min-height: 4.2em; /* 3行 × 1.4行高 */
  }
  
  .meta-row {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
  
  .meta-item-inline {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .modern-card-grid {
    padding: 12px;
  }
  
  .modern-card {
    padding: 16px;
  }
  
  .card-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
  }
  
  .card-title-section {
    width: 100%;
  }
  
  .card-title,
  .card-subtitle {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
  
  /* 小屏幕按钮布局优化 */
  .card-actions-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 4px;
    padding: 5px 0;
  }
  
  .action-btn {
    height: 36px;
    padding: 5px 2px;
    font-size: 8px;
  }
  
  .btn-icon {
    width: 12px;
    height: 12px;
  }
  
  .btn-text {
    font-size: 8px;
  }
}

/* 超小屏幕特殊处理 */
@media (max-width: 360px) {
  .card-actions-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 3px;
    padding: 4px 0;
  }
  
  .action-btn {
    height: 32px;
    padding: 4px 1px;
    font-size: 7px;
  }
  
  .btn-icon {
    width: 10px;
    height: 10px;
  }
  
  .btn-text {
    font-size: 7px;
  }
}

/* ==================== 搜索区域样式 ==================== */

.search-section {
  margin: 20px 0;
  background: #f8f9fa;
  border-radius: 8px;
  padding: 16px;
  border: 1px solid #e9ecef;
}

.search-container {
  max-width: 600px;
  margin: 0 auto;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  border-radius: 6px;
  padding: 4px;
  border: 1px solid #dee2e6;
  transition: all 0.3s ease;
}

.search-box:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 16px;
  font-size: 14px;
  color: #374151;
  outline: none;
}

.search-input::placeholder {
  color: #9ca3af;
}

.search-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 70px;
  justify-content: center;
}

.search-btn:hover:not(:disabled) {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.search-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.search-icon {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.search-icon.loading {
  animation: spin 1s linear infinite;
}

.clear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.clear-btn:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.clear-icon {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.search-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 6px 10px;
  background: #e3f2fd;
  border-radius: 4px;
  border-left: 3px solid #3b82f6;
}

.search-result-count {
  font-size: 13px;
  color: #1e40af;
  font-weight: 600;
}

.search-keyword {
  font-size: 12px;
  color: #64748b;
  background: #e2e8f0;
  padding: 3px 6px;
  border-radius: 3px;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* 搜索区域响应式设计 */
@media (max-width: 768px) {
  .search-section {
    padding: 16px;
    margin-bottom: 16px;
  }
  
  .search-box {
    flex-direction: column;
    gap: 8px;
    padding: 8px;
  }
  
  .search-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 13px;
  }
  
  .search-btn {
    width: 100%;
    padding: 10px 16px;
    font-size: 13px;
  }
  
  .search-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .search-section {
    padding: 12px;
  }
  
  .search-box {
    padding: 6px;
  }
  
  .search-input {
    padding: 8px 10px;
    font-size: 12px;
  }
  
  .search-btn {
    padding: 8px 12px;
    font-size: 12px;
    min-width: 60px;
  }
  
  .search-icon {
    width: 14px;
    height: 14px;
  }
  
  .clear-btn {
    width: 32px;
    height: 32px;
  }
  
  .clear-icon {
    width: 12px;
    height: 12px;
  }
}
</style>